home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.IOException;
- import symjava.sql.SQLException;
-
- public class NetString extends ServerObject {
- String _data;
-
- public NetString(String s) {
- if (s != null) {
- this._data = s;
- } else {
- this._data = new String("");
- }
- }
-
- public NetString() {
- this._data = new String("");
- }
-
- int getType() {
- return 52;
- }
-
- void read(DataInputStream in) throws SQLException, IOException, ErrorException {
- int _length = in.readShort();
- if (_length > 0) {
- byte[] b = new byte[_length];
- in.readFully(b, 0, _length);
- this._data = new String(b, 0);
- } else {
- this._data = new String("");
- }
- }
-
- void write(DataOutputStream out) throws IOException {
- int _length = this._data.length();
- out.writeByte(this.getType());
- out.writeShort(_length);
- if (_length > 0) {
- out.writeBytes(this._data);
- }
-
- }
-
- public String getString() {
- return this._data;
- }
-
- public String toString() {
- return this.getString();
- }
- }
-